/*
 *  POJ2488: A Knight's Journey
 */

/*-------- Includes --------*/
#include <iostream>
#include <stack>

using namespace std;

/*-------- Types --------*/
struct Point {
    int x, y;
public:
    Point(int i, int j) : x(i), y(j) {}
};

/*-------- Global Variables --------*/
int  p, q;          // p: number of rows, q: number of columns
bool mat[27][27];   // flag matrix

stack<Point> repo;  // repository of passed points

/*-------- Function Prototypes --------*/
void move(int &x, int &y, int dir);
bool dfs(int x, int y, int depth);
void display(stack<Point> *p);

/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    int nCase;

    cin >> nCase;

    for (int i = 0; i < nCase; i++) {
        bool isFound = false;

        // clear repository? do it in display function
        // while (!repo.empty()) repo.pop();

        // clear flag matrix? do it in display function
        // for (int r = 0; r < 27; r++)
        //     for (int s = 0; s < 27; s++)
        //         mat[r][s] = false;

        cin >> p >> q;

        // print case number
        cout << "Scenario #" << i + 1 << ":" << endl;

        // cut off 1(not necessary)
        if (p == 1 && q == 1) {
            cout << "A1" << endl << endl;
            continue;
        }

        // cut off 2(not necessary)
        if (p < 3 || q < 3 || p * q > 26) {
            cout << "impossible" << endl << endl;
            continue;
        }

        for (int s = 0; s < q; s++) {
            for (int r = 0; r < p; r++) {
                isFound = dfs(r, s, 1);

                if (isFound) break;
            }

            if (isFound) break;
        }

        // print results
        if (isFound) {
            display(&repo); cout << endl << endl;
        } else {
            cout << "impossible" << endl << endl;
        }
    }

    return 0;
}

/*-------- Functions --------*/
void move(int &x, int &y, int dir)
{
    switch (dir) {
        case 0: x -= 1; y -= 2; break;
        case 1: x += 1; y -= 2; break;
        case 2: x -= 2; y -= 1; break;
        case 3: x += 2; y -= 1; break;
        case 4: x -= 2; y += 1; break;
        case 5: x += 2; y += 1; break;
        case 6: x -= 1; y += 2; break;
        case 7: x += 1; y += 2; break;
        default: break;
    }
}

bool dfs(int x, int y, int depth)
{
    // visit (x, y)
    mat[x][y] = true;
    repo.push(Point(x, y));

    // base case
    if (depth == p * q) return true;

    // move on
    for (int i = 0; i < 8; i++) {
        int xx = x, yy = y;

        move(xx, yy, i);

        // detect bounary
        if (xx < 0 || xx >= p || yy < 0 || yy >= q) continue;

        // already visited
        if (mat[xx][yy]) continue;

        if (dfs(xx, yy, depth + 1)) return true;
    }

    // revert for tracing back
    mat[x][y] = false;
    repo.pop();

    return false;
}

void display(stack<Point> *p)
{
    if (!p->empty()) {
        Point pt = p->top(); p->pop();
        display(p);
        mat[pt.x][pt.y] = false;
        cout << (char)(pt.y + 'A') << pt.x + 1;
    }
}
